function pump
  close all
  omega = 2*pi;
  tspan = [0,1];
  initial_w = [0,0.05];
  
  [t_vals,sol_vals] = ode45(@(t,w) eom(t,w,omega),tspan,initial_w);
  plot(t_vals,sol_vals(:,1),'Linewidth',2,'Color','r');
  set(gca,'FontSize',14);
  xlabel('Time (s)');
  ylabel('Radial position (m)');
  grid on
  figure
  animate_impeller(t_vals,sol_vals,omega);
end
function dwdt = eom(t,w,omega)
   r = w(1); v = w(2);
   drdt = v;
   dvdt = r*omega^2;
   dwdt = [drdt;dvdt];
end
function animate_impeller(times,sol_vals,omega)
L = 1;
tx = sol_vals(:,1).*cos(omega*times);
ty = sol_vals(:,1).*sin(omega*times);
for i = 1:length(times)
   theta = omega*times(i);
   clf
   axis square
   xlim([-1,1]);
   ylim([-1,1]);
   hold on
   plot([0,L*cos(theta)],[0,L*sin(theta)],'LineWidth',2)
   r = sol_vals(i,1);
   plot([r*cos(theta)],[r*sin(theta)],'ro','MarkerSize',11,'MarkerFaceColor','r');
   plot(tx(1:i),ty(1:i),'LineWidth',1,'LineStyle','--','Color',[0,0,1])
   pause(0.15)
end

end